package rexsee.core.browser.clazz;

import java.util.ArrayList;

import rexsee.core.browser.Browser;
import android.content.Context;

public class LogListeners {

	public static final int LOG_TYPE_ERROR = 0;
	public static final int LOG_TYPE_EXCEPTION = 1;
	public static final int LOG_TYPE_MESSAGE = 2;

	private final ArrayList<LogListener> listeners;
	public LogListeners() {
		listeners = new ArrayList<LogListener>();
	}
	public void add(LogListener listner) {
		listeners.add(listner);
	}
	public void remove(LogListener listner) {
		listeners.remove(listner);
	}
	public void clear() {
		listeners.clear();
	}
	public void run(Context context, Browser browser, int type, String message) {
		for (int i = 0; i < listeners.size(); i++)
			listeners.get(i).run(context, browser, type, message);
	}
	public static abstract class LogListener {
		public abstract void run(Context context, Browser browser, int type, String message);
	}

}
